
// ------------------------------------------------------------------------------
pulse.widget.autosize = function( oEl )
{
	var iCols		= oEl.cols;
	var sContent 	= oEl.value;
	var iLineCount 	= 0;
	
	var iLastEOL = -1;
	do 
	{
	    var iBegin 	= iLastEOL + 1;
	    iLastEOL 		= sContent.indexOf( "\n", iLastEOL + 1 );
	    var sLine 	= "";
	    if ( iLastEOL != -1 ) {
	    	sLine = sContent.substring( iBegin, iLastEOL );
	    } else {
	    	sLine = sContent.substring( iBegin, sContent.length );
	    }
	    var iRowsInLine = Math.floor( sLine.length / iCols ) + 1;
	    iLineCount += iRowsInLine;
	} while ( iLastEOL != -1 );
	oEl.rows = iLineCount;
}

//------------------------------------------------------------------------------
pulse.widget.initAutoSizeArea = function()
{
	var lists = document.getElementsByTagName("textarea");
	for (var i = 0; i < lists.length; i++) 
	{
	    if ( lists[i].className = 'AutosizeArea' )
	    	pulse.widget.autosize( lists[i] );
	}
}